home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Corners.dxr / playing cards_55_foundation cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  1.5 KB  |  46 lines

  1. property spriteNum
  2. global foundation, equal, currentselect, franklist, fsuitlist, stock
  3.  
  4. on beginSprite me
  5.   foundation.addProp(makesymbol(spriteNum), new(script("card pile")))
  6.   temprank = franklist[random(franklist.count)]
  7.   tempsuit = fsuitlist[random(fsuitlist.count)]
  8.   sprite(spriteNum).member = member(temprank & "_" & tempsuit, "playing cards")
  9.   foundation[makesymbol(spriteNum)].addCard(spriteNum)
  10.   franklist.deleteOne(temprank)
  11.   fsuitlist.deleteOne(tempsuit)
  12.   removemefromstock()
  13. end
  14.  
  15. on removemefromstock me
  16.   repeat with i = 1 to stock.cards.count
  17.     if stock.cards[i].rank = foundation[makesymbol(spriteNum)].getlastcard().rank then
  18.       if stock.cards[i].suit = foundation[makesymbol(spriteNum)].getlastcard().suit then
  19.         stock.cards.deleteAt(i)
  20.       end if
  21.     end if
  22.   end repeat
  23. end
  24.  
  25. on mouseEnter me
  26.   if the clickOn <> 0 then
  27.     if (sprite(the clickOn).loc = the mouseLoc) and (the clickOn <> spriteNum) then
  28.       if (getlist(the clickOn).rankvalue = (foundation[makesymbol(spriteNum)].getlastcard().rankvalue + 1)) and (getlist(the clickOn).suit = foundation[makesymbol(spriteNum)].getlastcard().suit) then
  29.         equal = 1
  30.         currentselect = spriteNum
  31.       else
  32.         if (getlist(the clickOn).rank = "ace") and (foundation[makesymbol(spriteNum)].getlastcard().rank = "king") and (getlist(the clickOn).suit = foundation[makesymbol(spriteNum)].getlastcard().suit) then
  33.           equal = 1
  34.           currentselect = spriteNum
  35.         end if
  36.       end if
  37.     end if
  38.   end if
  39. end
  40.  
  41. on mouseLeave me
  42.   equal = 0
  43.   currentselect = 0
  44.   checkwin()
  45. end
  46.